



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

    <title>jb-aptech毕业设计项目</TITLE>
    <meta name="renderer" content="ie-comp">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <script src="../../script/common.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css"></link>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script src="/js/vue.js"></script>
</head>
<script type="text/javascript">

    function myAdd(){
        if(document.getElementById("rightCode").value=""){
            document.getElementById("codeSpan").innerHTML="不能为空";
            return;
        }
        if(document.getElementById("rightText").value=""){
            document.getElementById("textSpan").innetHTML="不能为空";
            return;
        }
        if(document.getElementById("rightUrl").value=""){
            document.getElementById("urlSpan").innerHTML="不能为空";
            return;
        }

        document.sysRightForm.submit();

    }
</script>
<body>
<div class="page_title">
    权限管理 > 权限管理 > 添加权限
</div>
<form name="sysRightForm" method="post" action="/CRM/sysRight.do" id="ui">
    <input type="hidden" name="method" value="addSysRight">
    <div class="button_bar">
        <button class="common_button" onclick="help('');">
            帮助
        </button>
        <button class="common_button" type="button" onclick="location='list.html'">
            返回
        </button>
        <button class="common_button" type="button" @click=" add()">
            保存
        </button>
    </div>
    <table class="query_form_table">
        <tr>
            <th>
                编号
            </th>
            <td>
                <input type="text" readonly value="无需填写">
                <span class="red_star" id="codeSpan">*</span>
            </td>
            <th>
                权限类型
            </th>
            <td>
                <select  v-model="might.right_icon">
                    <option value="Folder" >父节点</option>
                    <option value="Document">子节点</option>
                </select>
            </td>
            <th>
                父节点</th>
            <td><select v-model="might.right_parent_code">
                <option value="">请选择父节点-</option>
                <option v-for="s in SysMight" :value="s.right_parent_code" >{{s.right_text}}</option></select>
            </td>
        </tr>
        <tr>
            <th>
                权限文本
            </th>
            <td>
                <input type="text" v-model="might.right_text">
                <span class="red_star" id="textSpan">*</span>
            </td>
            <th>
                权限URL
            </th>
            <td>
                <input type="text" v-model="might.right_url">
                <span class="red_star" id="urlSpan">*</span>
            </td>
            <th>权限描述</th>
            <td>
                <textarea  v-model="might.right_tip"></textarea>
            </td>
        </tr>
    </table>

</form>
<script>
    var app = new Vue({
        el:'#ui',
        data:{
            SysMight:[],
            might:{
                right_parent_code:'',
                right_icon:'',
                right_text:'',
                right_url:'',
                right_tip:'',
            }
        },
        methods:{
            add(){
                $.post("/SysMight/save",this.might,function (json) {
                    if(json.code==200){
                        alert("保存成功");
                    }
                });
            }
        },
        created(){
            $.getJSON("/SysMight/query",{},function (json) {
                app.SysMight = json.data.list;
            });
        }
    });
</script>
</body>
</html>

